package org.opens.attr.controller;

import org.opens.attr.constant.AttrConstant;
import org.opens.attr.util.AttrUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 功能描述
 *
 * @author by zhangyuming
 * @date 2022/10/25
 */
@RestController
@RequestMapping(value = "/attr")
public class AttrController {

    @Autowired
    private AttrUtil attrUtil;

    @Value(value = "${tmpdir}")
    private String tmpdir;

    @RequestMapping(value = "/constant")
    public Map<String, Object> getConstant() {
        Map<String, Object> map = new HashMap<>();
        map.put("name", AttrConstant.name);
        map.put("tmpdir", tmpdir);
        return map;
    }

    @RequestMapping(value = "/util")
    public Map<String, Object> getUtil() {
        Map<String, Object> map = new HashMap<>();
        map.put("data", attrUtil);
        return map;
    }

}
